<div class="file-list">
  <mat-list>
    <mat-list-item
      *ngFor="let fm of fileMetas"
      [attr.data-file-meta-id]="fm.id"
      [attr.data-workflow-spec-id]="workflowSpec.id"
    >
      <mat-icon (click)="editFile(fm)" mat-list-icon>{{fm.type | getIconCode}}</mat-icon>
      <ng-container *ngIf="fm.type === fileType.BPMN && !this.workflowSpec.library">
        <button (click)="makePrimary(fm)" *ngIf="!(fm.name === this.workflowSpec.primary_file_name)" mat-flat-button class="make-primary">
          <mat-icon>radio_button_unchecked</mat-icon>
          Make primary process
        </button>
        <button *ngIf="fm.name === this.workflowSpec.primary_file_name" mat-flat-button class="make-primary">
          <mat-icon>radio_button_checked</mat-icon>
          Primary process
        </button>
      </ng-container>
      <h4 (click)="editFile(fm)" mat-line>{{fm.name}}</h4>
      <p (click)="editFile(fm)" mat-line> Updated on {{fm.last_modified | date:'medium'}}
      <span *ngIf="fm.user_uid"> by {{fm.user_uid}}</span>
      </p>
      <button (click)="downloadFile(fm)" class="mat-elevation-z0" color="primary" mat-icon-button>
        <mat-icon>save_alt</mat-icon>
      </button>
      <button (click)="editFile(fm)" class="mat-elevation-z0" color="primary" mat-icon-button>
        <mat-icon>edit</mat-icon>
      </button>
      <button (click)="confirmDelete(fm)" class="mat-elevation-z0" color="warn" mat-icon-button>
        <mat-icon>delete</mat-icon>
      </button>
    </mat-list-item>
  </mat-list>
</div>
<div class="file-list-actions">
  <button [queryParams]="{action: 'newFile'}" [routerLink]="['/modeler/' + workflowSpec.id]" mat-button>
    <mat-icon>note_add</mat-icon>
    Add new BPMN or DMN file
  </button>
  <button [queryParams]="{action: 'openFile'}" [routerLink]="['/modeler/' + workflowSpec.id]" mat-button>
    <mat-icon>cloud_upload</mat-icon>
    Upload BPMN or DMN file
  </button>
  <button (click)="editFile()" mat-button>
    <mat-icon>cloud_upload</mat-icon>
    Upload Template file
  </button>
</div>
